﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.IO;

namespace Wicresoft.SMS.OMSService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://schemas.microsoft.com/office/Outlook/2006/OMS")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class OMSService : System.Web.Services.WebService
    {
        IOmsAgent _agent = new Agent();

        [WebMethod]
        public string GetServiceInfo()
        {
            return _agent.GetServiceInfo();
        }
        [WebMethod]
        public string GetUserInfo(string xmsUser)
        {
            return _agent.GetUserInfo(xmsUser);
        }

        [WebMethod]
        public string DeliverXms(string xmsData)
        {
            return _agent.DeliverXms(xmsData);
        }

        [WebMethod]
        public string SendXms(string xmsData)
        {
            return _agent.SendXms(xmsData);
        }

        /// <summary>
        /// return contacts string of the consider userkey
        /// password will be varified,if user is invalid , null will be return
        /// otherwise at least contactData will be return
        /// </summary>
        /// <param name="UserKey">(canbe id,alias,email)</param>
        /// <param name="Password">password</param>
        /// <returns></returns>
        [WebMethod]
        public string GetContacts(string UserKey, string Password)
        {
            return _agent.GetContacts(UserKey, Password);
        }

        [WebMethod]
        public string SetReminder(string Owner, string Mobile, string reminderData)
        {
            return _agent.SetReminder(Owner, Mobile, reminderData);
        }

        [WebMethod]
        public string WriteLog(DateTime dt, string product, string type, string msg, string user)
        {
            return _agent.WriteLog(dt, product, type, msg, user); 
        }

        [WebMethod]
        public string GetEmailByCSL(string csl)
        {
            return _agent.GetGetEmailByCSL(csl);
        }

        [WebMethod]
        public string GetMobileByCSL(string csl)
        {
            return _agent.GetMobileByCSL(csl); 
        }

        [WebMethod]
        public bool CheckEmail(string email)
        {
            return _agent.CheckEmail(email);
        }

        [WebMethod]
        public bool CheckState()
        {
            return true;
        }

        [WebMethod]
        public UserInfo GetUserInfoByCSL(string csl)
        {
            return _agent.GetUserInfoByCSL(csl); 
        }

        [WebMethod]
        public UserInfo GetUserInfoByCIL(string cil)
        {
            return _agent.GetUserInfoByCIL(cil);
        }

        [WebMethod]
        public bool AuthUser(string username, string pwd)
        {
            return _agent.AuthUser(username, pwd);  
        }
    }
}